package com.weixin.dao;

import com.weixin.bean.MessageBean;
import com.weixin.dao.baseDao.MyMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Update;

/**
 * Created by Administrator on 2018-01-23.
 */
@Mapper
public interface IMessageDao extends MyMapper<MessageBean> {

    @Insert("insert into message(toUserName,fromUserName,createTime,msgType,content,MsgId,isReply) values(#{toUserName},#{fromUserName},#{createTime},#{msgType},#{content},#{MsgId},'0')")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    Long insertMessageDao(MessageBean messageBean);

    @Update("UPDATE message SET isReply = 1 WHERE id=#{id}")
    void updateReply(MessageBean messageBean);
}
